<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%file_list_notice}}".
 *
 * @property int $id
 * @property string $assurerno 担保单位编号
 * @property string $filetype 文件的类型
 * @property string $filesrc 文件获取的地址
 * @property int $datadt 数据日期
 * @property int $status
 *
 * @property FileListDownloadLog[] $fileListDownloadLogs
 */
class FileListNotice extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%file_list_notice}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['assurerno', 'filetype', 'filesrc', 'datadt'], 'required'],
            [['datadt', 'status'], 'integer'],
            [['assurerno'], 'string', 'max' => 4],
            [['filetype'], 'string', 'max' => 19],
            [['filesrc'], 'string', 'max' => 100],
            [['filesrc'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'assurerno' => Yii::t('app', '担保单位编号'),
            'filetype' => Yii::t('app', '文件的类型'),
            'filesrc' => Yii::t('app', '文件获取的地址'),
            'datadt' => Yii::t('app', '数据日期'),
            'status' => Yii::t('app', 'Status'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getFileListDownloadLogs()
    {
        return $this->hasMany(FileListDownloadLog::className(), ['file_list_notice_id' => 'id']);
    }
}
